package psn.zjk.exporter.utils;

import java.io.File;
import java.io.IOException;

public class FileUtils {

    private FileUtils() {
    }

    public static File getOrCreateFile(String name) throws IOException {
        File file = new File(name);
        createIfNotExist(file);
        return file;
    }

    public static void createIfNotExist(File file) throws IOException {
        File parentFile = file.getParentFile();
        if (parentFile!=null&&!parentFile.exists()) {
            parentFile.mkdirs();
        }

        if (!file.exists()) {
            file.createNewFile();
        }
    }
}
